/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package radio.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Huu Vinh
 */
@Embeddable
public class PaymentDetailsPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "AccId", nullable = false)
    private int accId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PaymentId", nullable = false)
    private int paymentId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PaymentDate", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date paymentDate;

    public PaymentDetailsPK() {
    }

    public PaymentDetailsPK(int accId, int paymentId, Date paymentDate) {
        this.accId = accId;
        this.paymentId = paymentId;
        this.paymentDate = paymentDate;
    }

    public int getAccId() {
        return accId;
    }

    public void setAccId(int accId) {
        this.accId = accId;
    }

    public int getPaymentId() {
        return paymentId;
    }

    public void setPaymentId(int paymentId) {
        this.paymentId = paymentId;
    }

    public Date getPaymentDate() {
        return paymentDate;
    }

    public void setPaymentDate(Date paymentDate) {
        this.paymentDate = paymentDate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) accId;
        hash += (int) paymentId;
        hash += (paymentDate != null ? paymentDate.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PaymentDetailsPK)) {
            return false;
        }
        PaymentDetailsPK other = (PaymentDetailsPK) object;
        if (this.accId != other.accId) {
            return false;
        }
        if (this.paymentId != other.paymentId) {
            return false;
        }
        if ((this.paymentDate == null && other.paymentDate != null) || (this.paymentDate != null && !this.paymentDate.equals(other.paymentDate))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "radio.entities.PaymentDetailsPK[ accId=" + accId + ", paymentId=" + paymentId + ", paymentDate=" + paymentDate + " ]";
    }
    
}
